package com.wtp.wallpaper.es.service;

import com.wtp.wallpaper.es.Repository.ProductRepository;
import com.wtp.wallpaper.es.document.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class ProductService {

    @Autowired
    private ProductRepository productRepository;

    public Product saveProduct(Product product) {
        return productRepository.save(product);
    }

    public List<Product> findByName(String name) {
        return productRepository.findByNameContaining(name);
    }

    public Iterable<Product> findAll() {
        return productRepository.findAll();
    }
}
